package org.zfes.snowier.cloud.zbss.pmp.router.service.ma;

import java.util.Map;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.pmp.model.PmpPostgrade;
import org.zfes.snowier.cloud.zbss.pmp.service.IPmpPostgradeService;
@Controller ("org.zfes.snowier.cloud.zbss.pmp.router.service.ma.pmpPostgradeController")
@RequestMapping("/pmp/service/ma/pmpPostgrade")
public class PmpPostgradeController extends BaseController {

	
	@Autowired
	private IPmpPostgradeService pmpPostgradeService;
	
    @RequestMapping(value="/loadpmpPostgradeDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadpmpPostgradeDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  pmpPostgradeService.loadpmpPostgradeDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
    @RequestMapping(value="/createpmpPostgrade", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createpmpPostgrade(PmpPostgrade pmpPostgrade){
		pmpPostgradeService.createpmpPostgrade(pmpPostgrade);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
    @RequestMapping(value="/loadpmpPostgrade", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadpmpPostgrade(Long id){
		Optional<PmpPostgrade> ops = pmpPostgradeService.loadpmpPostgradeById(id);
		return ajaxQuery("pmpPostgrade",ops);
    }
	
    @RequestMapping(value="/updatepmpPostgrade", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updatepmpPostgrade(PmpPostgrade pmpPostgrade){
		pmpPostgradeService.updatepmpPostgrade(pmpPostgrade);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
    @RequestMapping(value="/deletepmpPostgrade", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deletepmpPostgrade(Long id){
		pmpPostgradeService.setpmpPostgradeStatus(id, Byte.valueOf("-1"));
		return ajaxDoneSuccess("数据操作成功 ");
    }

}